package com.qf.utils;


import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @author YDW
 * projectName:4_01_jedis
 * time:2022/6/6 23:00
 * description:
 */

public class EsClient {

    public static RestHighLevelClient createClient(){
        //创建和服务器的连接
        HttpHost httpHost=new HttpHost("120.48.49.214",9200);
        //创建RestClient对象
        RestClientBuilder builder=RestClient.builder(httpHost);
        //创建可返回的连接
        RestHighLevelClient client=new RestHighLevelClient(builder);

        return  client;
    }

}
